package main

import (
	"fmt"
	//"flag"
	"net/http"

	"github.com/rafttest/api"
)

func main() {

	//var nodeId = flag.Uint64("n", 0, "node id")
	//flag.Parse()

	//fmt.Println("nodeId:", *nodeId)
	

	api.InitNetWork()
	
	
	startApiServer()

}

func startApiServer() error {
	router := api.HandlerRouter()
	http.Handle("/", router)

	addr := fmt.Sprintf(":%d", 8099)
	if err := http.ListenAndServe(addr, nil); err != nil {
		return err
	}

	return nil
}

